import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class HJ71 {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String in;
        while((in = br.readLine())!=null){
            String temp = br.readLine();
            System.out.println(getOc(in,temp));
            //System.out.println(getOc(in,temp,0,0));
        }
    }

    public static  boolean getOc(String in,String temp){
        //字符串通配符
        in = in.replaceAll("\\?", "[0-9A-Za-z]{1}");
        in = in.replaceAll("\\*", "[0-9A-Za-z]{0,}");
        //in = in.replaceAll("\\.", "\\\\.");
        return temp.matches(in);
    }

}
